<div class="main-content">
	<div class="main-content-inner">
		<div class="breadcrumbs ace-save-state" id="breadcrumbs">
			<ul class="breadcrumb">
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					<a href="#">首页</a>
				</li>
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					宿舍管理
				</li>
				<li class="active">日常管理</li>
			</ul><!-- /.breadcrumb -->

			<div class="nav-search" id="nav-search">
				<form class="form-search">
					<span class="input-icon">
						<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
						<i class="ace-icon fa fa-search nav-search-icon"></i>
					</span>
				</form>
			</div><!-- /.nav-search -->
		</div>

		<div class="page-content">
			<div class="page-header">
				<h1>
					日常管理

					<div class="pull-right inline">
						<button class="btn btn-white btn-success btn-round">
							<i class="ace-icon fa fa-pencil green2"></i>
							增加
						</button>
						<button class="btn btn-white btn-danger btn-round">
							<i class="ace-icon fa fa-times red2"></i>
							删除
						</button>
					</div>
				</h1>
			</div><!-- /.page-header -->

			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">
							<div class="widget-box widget-color-blue2">
								<div class="widget-body">
									<div class="widget-main padding-8">
										<ul id="tree1"></ul>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- PAGE CONTENT ENDS -->
				</div><!-- /.col -->
			</div><!-- /.row -->
		</div><!-- /.page-content -->
	</div>
</div><!-- /.main-content -->
<!-- basic scripts -->

		<!--[if !IE]> -->
		<script src="../../../../public/static/assets/js/jquery-2.1.4.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='../../../../public/static/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="../../../../public/static/assets/js/bootstrap.min.js"></script>

		<!-- page specific plugin scripts -->
		<script src="../../../../public/static/assets/js/tree.min.js"></script>

		<!-- ace scripts -->
		<script src="../../../../public/static/assets/js/ace-elements.min.js"></script>
		<script src="../../../../public/static/assets/js/ace.min.js"></script>

		<!-- inline scripts related to this page -->
<script type="text/javascript">
	jQuery(function($){
		var sampleData = initiateDemoData();//see below

		$('#tree1').ace_tree({
			dataSource: sampleData['dataSource1'],
			multiSelect: true,
			cacheItems: true,
			'open-icon' : 'ace-icon tree-minus',
			'close-icon' : 'ace-icon tree-plus',
			'itemSelect' : true,
			'folderSelect': false,
			'selected-icon' : 'ace-icon fa fa-check',
			'unselected-icon' : 'ace-icon fa fa-times',
			loadingHTML : '<div class="tree-loading"><i class="ace-icon fa fa-refresh fa-spin blue"></i></div>'
		});

		function initiateDemoData(){
			var tree_data = {
				'dorm5' : {text: '5号楼', type: 'folder'},
				'dorm8' : {text: '8号楼', type: 'folder'},
				'dorm9' : {text: '9号楼', type: 'folder'},
				'dorm13' : {text: '13号楼', type: 'folder'},
				'dorm14' : {text: '14号楼', type: 'folder'}
			}
			tree_data['dorm5']['additionalParameters'] = {
				'children' : {
					'5202' : {text: '5202', type: 'folder'},
					'5203' : {text: '5203', type: 'folder'},
					'5204' : {text: '5204', type: 'folder'},
					'5205' : {text: '5205', type: 'folder'},
				}
			}
			tree_data['dorm5']['additionalParameters']['children']['5202']['additionalParameters'] = {
				'children' : {
					'stu1' : {text: '张三', type: 'item'},
					'stu2' : {text: '李四', type: 'item'},
					'stu3' : {text: '赵五', type: 'item'},
					'stu4' : {text: '王二麻子', type: 'item'},
				}
			}

			var dataSource1 = function(options, callback){
				var $data = null
				if(!("text" in options) && !("type" in options)){
					$data = tree_data;//the root tree
					callback({ data: $data });
					return;
				}
				else if("type" in options && options.type == "folder") {
					if("additionalParameters" in options && "children" in options.additionalParameters)
						$data = options.additionalParameters.children || {};
					else $data = {}//no data
				}
				
				if($data != null)//this setTimeout is only for mimicking some random delay
					setTimeout(function(){callback({ data: $data });} , parseInt(Math.random() * 500) + 200);

				//we have used static data here
				//but you can retrieve your data dynamically from a server using ajax call
				//checkout examples/treeview.html and examples/treeview.js for more info
			}
			return {'dataSource1': dataSource1}
		}
	});
</script>
